<!DOCTYPE html>
<html>
<head>
	<title>js实现websocket</title>
</head>
<body>





<script language='javascript' src='./service/WebSocket.js?t=13'></script>
<script>

var _WEBSOCKET_;
window.onload = function (){	
		_WEBSOCKET_ = new myWebSocket();
 
		let timeout = 10000;//60ms timeout: 10000, //9分钟发一次心跳0000
 
	  let host= "wss://123456/websocket/";
	  
 
	
	// host = "ws://12/websocket/";

	let  ping_send_body = {'type':'update_online','data':{'id': 'kjjjEMDRX4X49K88011188880' } };	 
		_WEBSOCKET_.set_host(host).set_timeout(timeout).set_ping_send_body(ping_send_body).connect();
		
		
		
	//	let obj = {'id': 123,'data':'95222','time': new Date().getTime( ) }; 	
		// _WEBSOCKET_.send_data(obj);
		// setTimeout(function(){
	//	 _WEBSOCKET_.send_data(obj);
		  
		//},2000);
}
window.onunload = function() {
 _WEBSOCKET_.close();
}	
 	 
</script>


<script type="text/javascript">
	


</script>


</body>
</html>